package l2ft.gameserver.handler.voicecommands.impl;


import l2ft.gameserver.data.htm.HtmCache;
import l2ft.gameserver.handler.voicecommands.IVoicedCommandHandler;
import l2ft.gameserver.model.Player;
import l2ft.gameserver.model.entity.CharacterControlPanel;
import l2ft.gameserver.scripts.Functions;

public class Cfg extends Functions implements IVoicedCommandHandler
{
	private String[] _commandList = new String[] { "char" };
	
	public boolean useVoicedCommand(String command, Player activeChar, String args)
	{
		String nextPage = CharacterControlPanel.getInstance().useCommand(activeChar, args, "-h user_char ");
		if(nextPage == null || nextPage.isEmpty())
			return true;
		String html = "command/"+nextPage;
		
		String dialog = HtmCache.getInstance().getNotNull(html, activeChar);

		String additionalText = args.split(" ").length > 1 ? args.split(" ")[1] : "";
		dialog = CharacterControlPanel.getInstance().replacePage(dialog, activeChar, additionalText, "-h user_char ");

		show(dialog, activeChar);

		return true;
	}

	public String[] getVoicedCommandList()
	{
		return _commandList;
	}
}